#pragma warning disable 0618
using System;
using System.Collections.Generic;
using Table.DataModel;
namespace Table.Dao
{
    public class TableSkillDao:DaoBase<TableSkill>
    {
        public override string GetFileName()
        {
            return "TableSkill.csv";
        }
        public override void BuildIndex()
        {
            if (cacheList != null)
            {
                cachePrimaryInt = new Dictionary<int, TableSkill>(cacheList.Count);
            }
            base.BuildIndex();
        }
        public override void AddOneIndex(TableSkill model)
        {
            if (!cacheOneIndex.ContainsKey(model.heroId.ToString()))
            {
                cacheOneIndex[model.heroId.ToString()] = new List<TableSkill>();
            }
            cacheOneIndex[model.heroId.ToString()].Add(model);
        }
        public override void AddPrimaryIndex(TableSkill model)
        {
            #if UNITY_EDITOR
            if(cachePrimaryInt.ContainsKey(model.skillId)) UnityEngine.Debug.LogError("数据表id重复:TableSkill->id: " + model.skillId);
            #endif
            cachePrimaryInt[model.skillId] = model;
        }
        protected override TableSkill ParseRowData(string[] rowData)
        {
            TableSkill data = new TableSkill();
            if (!string.IsNullOrEmpty(rowData[0]))
            {
                data.skillId = int.Parse(rowData[0]);
            }
            if (!string.IsNullOrEmpty(rowData[1]))
            {
                data.heroId = int.Parse(rowData[1]);
            }
            if (!string.IsNullOrEmpty(rowData[2]))
            {
                data.skillType = int.Parse(rowData[2]);
            }
            if (!string.IsNullOrEmpty(rowData[3]))
            {
                data.skillCostType = int.Parse(rowData[3]);
            }
            if (!string.IsNullOrEmpty(rowData[4]))
            {
                data.skillStep = int.Parse(rowData[4]);
            }
            if (!string.IsNullOrEmpty(rowData[5]))
            {
                data.maxLevel = int.Parse(rowData[5]);
            }
            if (!string.IsNullOrEmpty(rowData[6]))
            {
                data.isExtensionSkill = int.Parse(rowData[6]);
            }
            if (!string.IsNullOrEmpty(rowData[7]))
            {
                data.relationSkillId = int.Parse(rowData[7]);
            }
            if (!string.IsNullOrEmpty(rowData[8]))
            {
                data.isRelationSkill = int.Parse(rowData[8]);
            }
            if (!string.IsNullOrEmpty(rowData[9]))
            {
                data.skillName = string.Intern(rowData[9]);
            }
            if (!string.IsNullOrEmpty(rowData[10]))
            {
                data.skillDesc = string.Intern(rowData[10]);
            }
            if (!string.IsNullOrEmpty(rowData[11]))
            {
                data.skillDescBase = rowData[11];
            }
            if (!string.IsNullOrEmpty(rowData[12]))
            {
                data.skillIcon = rowData[12];
            }
            if (!string.IsNullOrEmpty(rowData[13]))
            {
                data.belongSkillId = int.Parse(rowData[13]);
            }
            if (!string.IsNullOrEmpty(rowData[14]))
            {
                data.preSkillId = ParseData<int>(rowData[14]);
            }
            if (!string.IsNullOrEmpty(rowData[15]))
            {
                data.unlockPreSkillLevel = ParseData<int>(rowData[15]);
            }
            if (!string.IsNullOrEmpty(rowData[16]))
            {
                data.unlockHeroStarNum = int.Parse(rowData[16]);
            }
            if (!string.IsNullOrEmpty(rowData[17]))
            {
                data.unlockHeroBreachLevel = int.Parse(rowData[17]);
            }
            if (!string.IsNullOrEmpty(rowData[18]))
            {
                data.effectSkillId = ParseData<int>(rowData[18]);
            }
            if (!string.IsNullOrEmpty(rowData[19]))
            {
                data.viewHierarychy = int.Parse(rowData[19]);
            }
            if (!string.IsNullOrEmpty(rowData[20]))
            {
                data.viewVertical = int.Parse(rowData[20]);
            }
            if (!string.IsNullOrEmpty(rowData[21]))
            {
                data.costActionPoint = int.Parse(rowData[21]);
            }
            if (!string.IsNullOrEmpty(rowData[22]))
            {
                data.costAnger = int.Parse(rowData[22]);
            }
            if (!string.IsNullOrEmpty(rowData[23]))
            {
                data.damageGrade = int.Parse(rowData[23]);
            }
            if (!string.IsNullOrEmpty(rowData[24]))
            {
                data.isFinal = int.Parse(rowData[24]);
            }
            if (!string.IsNullOrEmpty(rowData[25]))
            {
                data.isEnd = int.Parse(rowData[25]);
            }
            if (!string.IsNullOrEmpty(rowData[26]))
            {
                data.cooldown = int.Parse(rowData[26]);
            }
            if (!string.IsNullOrEmpty(rowData[27]))
            {
                data.SailorSkillId = int.Parse(rowData[27]);
            }
            if (!string.IsNullOrEmpty(rowData[28]))
            {
                data.needSwitch = int.Parse(rowData[28]);
            }
            if (!string.IsNullOrEmpty(rowData[29]))
            {
                data.PropList = string.Intern(rowData[29]);
            }
            if (!string.IsNullOrEmpty(rowData[30]))
            {
                data.PropPercentList = string.Intern(rowData[30]);
            }
            if (!string.IsNullOrEmpty(rowData[31]))
            {
                data.buffGroupId = int.Parse(rowData[31]);
            }
            if (!string.IsNullOrEmpty(rowData[32]))
            {
                data.mainBuffId = int.Parse(rowData[32]);
            }
            if (!string.IsNullOrEmpty(rowData[33]))
            {
                data.buffTimings = string.Intern(rowData[33]);
            }
            if (!string.IsNullOrEmpty(rowData[34]))
            {
                data.buffTargets = string.Intern(rowData[34]);
            }
            if (!string.IsNullOrEmpty(rowData[35]))
            {
                data.buffConditions = string.Intern(rowData[35]);
            }
            if (!string.IsNullOrEmpty(rowData[36]))
            {
                data.buffOddRules = rowData[36];
            }
            if (!string.IsNullOrEmpty(rowData[37]))
            {
                data.buffOddGrades = string.Intern(rowData[37]);
            }
            if (!string.IsNullOrEmpty(rowData[38]))
            {
                data.buffList = ParseData<int>(rowData[38]);
            }
            if (!string.IsNullOrEmpty(rowData[39]))
            {
                data.buffGradeList = string.Intern(rowData[39]);
            }
            if (!string.IsNullOrEmpty(rowData[40]))
            {
                data.possibleTransferSkillIds = ParseData<int>(rowData[40]);
            }
            if (!string.IsNullOrEmpty(rowData[41]))
            {
                data.detailDesc = rowData[41];
            }
            if (!string.IsNullOrEmpty(rowData[42]))
            {
                data.buttonEffect = rowData[42];
            }
            return data;
        }
    }
}
